/** 报关单列表的更多设置body全局事件 */
import { on, off } from '@/libs/tools'

export default {
    activated () {
        on(document.body, 'click', this.outSideClick)
    },
    deactivated () {
        off(document.body, 'click', this.outSideClick)
    },
    beforeDestroy () {
        off(document.body, 'click', this.outSideClick)
    },
    methods: {
        outSideClick (e) {
            let elem = e.target || e.srcElement
            let elemClassName = elem.className
            if (!elemClassName || elemClassName.indexOf('t-setting-icon') < 0) {
                document.querySelector('.more-box').style.setProperty('display', 'none')
            }
        },
        showMoreBox (x, y) {
            let X = x + 'px'
            let Y = y + 'px'
            document.querySelector('.more-box').style.setProperty('top', Y)
            document.querySelector('.more-box').style.setProperty('left', X)
            document.querySelector('.more-box').style.setProperty('display', 'block')
        }
    }
}
